home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 151-175 / scopedisk174 / xaread / xaread.doc < prev    next >
Text File  |  1995-03-19  |  16KB  |  333 lines

  1.                                       
  2.                                       
  3.       XARead - Batch files to assist Amiga-Bridgeboard File Transfer.
  4.  
  5.  
  6. I.        Background.
  7.  
  8. When I got my bridgeboard, I became frustrated early on with the limitations
  9. in transferring files from the Amiga side  to the Bridgeboard side, and vice
  10. versa.  Most frustrating  was  the  lack  of  support  for wild cards.  When
  11. sending something from the IBM  side  to  the  Amiga side, it wasn't so bad,
  12. because at least the AWRITE command understood MS-DOS wild cards.  But using
  13. AREAD, you had to spell out the entire file name for each file you wanted to
  14. transfer.  For example, when I had twenty  GIF files I wanted to move to the
  15. IBM side, I would have liked to have a command like this:
  16.  
  17.      AREAD #?.GIF /b   or,
  18.      AREAD *.GIF  /b      
  19.  
  20. Unfortunately, no such  facility  exists.   Nope,  you  have to enter twenty
  21. AREAD commands, with the full  filename  on  each one.  A desire to overcome
  22. this obstacle is what led me to write  XAREAD  (eXtended AREAD), a short and
  23. deceptively simple set  of  batch  files  that  allows  me to get around the
  24. problem.
  25.  
  26.  
  27. II.       What is XAREAD?
  28.  
  29. XAREAD is two batch files - one for the  Amiga side and one for the IBM side
  30. - that work together to  allow  a  user  to  specify  AmigaDOS wild cards to
  31. transfer files from the  Amiga  side  to  the  IBM  side.  The solution is a
  32. little cheesy, but it does work, and once you've used it for mass transfers,
  33. you'll love it despite its dairy heritage.
  34.  
  35. Basically, I cheat.  The way it works  is  that XAREAD, an Amiga batch file,
  36. runs on the Amiga side, and uses the  wild  cards you specify to look up the
  37. files that that spec includes.   It  invokes  the  AmigaDOS  LIST command to
  38. build an MS-DOS syntax batch file named  T:ZZZAREAD.BAT.  Then you go to the
  39. MS-DOS side of the BridgeBoard and execute XAREAD.BAT, an MS-DOS batch file.
  40. This batch file AREADs over the ZZZAREAD.BAT file, and then executes it.  In
  41. turn, ZZZAREAD.BAT moves over all those files you specified.  So in the end,
  42. you run one command on each side.  Nice, huh?
  43.  
  44.  
  45. III.      Requirements.
  46.  
  47. I really wrote this for my own use and,  while I tried to keep it open-ended
  48. enough to work for everyone,  there  are  no  guarantees.   I'm running with
  49. MS-DOS 3.2, AmigaDOS 1.3, with Janus 2.0  on an A2000 equipped with an A2088
  50. BridgeBoard.  I suspect it should  work  with  lower levels of MS-DOS, and I
  51. hope it   would be upward compatible  to  higher  levels (in fact, there's a
  52. cleaner way of invoking  ZZZAREAD.BAT  from  XAREAD.BAT  in MS-DOS 3.3 - the
  53. CALL command - but the 3.2 way should also  continue to work).  On the Amiga
  54. side, XAREAD uses the LFORMAT option of LIST, which only became available in
  55. 1.3.  I don't think Janus level  or  the  type  of  bridgeboard should be an
  56. issue, as long as the AREAD command works properly.
  57.  
  58.  
  59. IV.       Syntax.
  60.  
  61. The general syntax for invoking XAREAD on the Amiga side is:
  62.  
  63.      XAREAD <amigafile-spec> <msdos-directory> [optional flags]
  64.  
  65. On the IBM side, there are no operands.  Just invoke it like this:
  66.  
  67.      XAREAD
  68.  
  69. Remember, the intelligence of  AmigaDOS  is  doing all the behind the scenes
  70. work, and the IBM XAREAD command is just to consummate the transfer.
  71.  
  72. The  "<amigafile-spec>"   can   technically   be  any  valid  AmigaDOS  file
  73. specification, with or  without  wildcards.   However,  there's an important
  74. consideration to take into  account.   First,  I'll  give the Long Drawn Out
  75. Explanation for those of you who  really  care,  and then for those who just
  76. want the silly thing to work,  I'll  give  a  Good  Rule Of Thumb to make it
  77. work.
  78.  
  79. LDOE:  Because of the way the Bridgeboard is set up, when an AREAD is issued
  80. on the MS-DOS side, if the AmigaDOS file  name is relatively specified (e.g.
  81. "mydir/file1.txt"  or  just  "file1.txt"),  the  filename  will  be resolved
  82. against whatever was the current  directory  at the time the Bridgeboard was
  83. activated (when you clicked on  the  "PC  Color"  or  "PC Mono" icon).  This
  84. directory is the one in which  the  icons  exist.   For  me (and I think the
  85. standard), that's SYS:PC.  So when  you  do an AREAD for "file1.txt", XAREAD
  86. will look for "SYS:PC/file1.txt".  When  you  AREAD "mydir/file1.txt", it'll
  87. look for  "SYS:PC/mydir/file1.txt".   This  presents  no problems as long as
  88. your  current  directory  is  SYS:PC  when  you  invoke  XAREAD;  Amiga  and
  89. BridgeBoard are on the same page, as it were.  The problem is if you're CDed
  90. to the directory SYS:GIFPics and try  the  command XAREAD #?.GIF.  This will
  91. generate a lot of AREAD commands to get FILE1.GIF, FILE2.GIF, etc.  The only
  92. problem is that when  the  AREADs  eventually  execute  on  the MS-DOS side,
  93. they'll be looking for SYS:PC/FILE1.GIF, etc. and the AREADs will fail.  The
  94. best way to avoid this problem is to  always  use  an absolute reference for
  95. the  Amiga filespec when using XAREAD.
  96.  
  97. GROT:  As long as you include a colon  (:)  in the Amiga file specification,
  98. the specification will be  an  absolute  one,  and XAREAD on the MS-DOS side
  99. will have no trouble finding  the  files  to  be received.  The colon can be
  100. part of a device name (e.g.  DF2:,  JH0:,  RAM:),  a  disk volume name (e.g.
  101. GIFPics01:, LotusFiles-17:), or  ASSIGNed  name (WHAP:, TEMP:, S:).  The one
  102. exception is  starting  with  the  colon  (which  would  indicate  the  root
  103. directory of the  disk  you're  currently  CDed  to).   That'll only work if
  104. you're CDed to the same disk device that contained the directory that the PC
  105. session was launched from.   By  the  way,    XAREAD  cannot  check that you
  106. included a colon.  I  could  have  written  it  in  ARexx and checked, but I
  107. wanted to make sure anyone could use it, not just ARexx owners.
  108.  
  109. As far as the IBM destination directory is concerned, you can use   whatever
  110. directory specification you  want.   Just  remember  that the directory must
  111. already exist.  If you specify a directory that doesn't exist, the XAREAD on
  112. the IBM side will fail.
  113.  
  114. I'm assuming you're more or less familiar  with the MS-DOS directory scheme,
  115. but there are some subtleties you ought to be aware of.  First, to reference
  116. the current directory,  you  could  normally  just  leave  off any directory
  117. specification on most MS-DOS commands  (AREAD  included).  Unfortunately, if
  118. you leave out the destination directory  on XAREAD, it isn't smart enough to
  119. realize that any flags  you've  specified  are  flags, and not the name of a
  120. directory on the MS-DOS side,  so  you  MUST  specify  an MS-DOS destination
  121. directory.
  122.  
  123. However, the MS-DOS directory CAN be relative.   The easiest is to  just use
  124. a period (.)  to  indicate  the  current  directory.   Or  you  can  use the
  125. backslash (\) to indicate the  root,  or  a  directory relative to the root.
  126. Just to round things out, the double-period  (..) can be used to specify the
  127. directory that is the immediate parent of the current MS-DOS directory.  I'm
  128. sorry if this all sounds complicated.   It's really not.  It'll all be clear
  129. when you look at the examples.
  130.  
  131. The "optional flags" are any flags  allowed  by the AREAD command.  The only
  132. one I ever use  is  "/b"  (binary),  to  transfer  non-text  files  with  no
  133. character translation.
  134.  
  135.  
  136. V.        Installation.
  137.  
  138. I'm assuming you've  already  got  the  Bridgeboard  hardware  and  software
  139. installed and  working.   The  Janus-supplied  AREAD  command  must  be in a
  140. directory that is in your MS-DOS execution path.
  141.  
  142. Put the file XAREAD  in  your  AmigaDOS  S:  directory.   You can either use
  143. EXECUTE to execute it, or else  designate  it  as an executable script file,
  144. and forget the hassle of typing EXECUTE  each time you use it.  The examples
  145. in this document file assume you've  done  this.  Just issue the CLI command
  146. PROTECT S:XAREAD +S, and it'll be  marked  as executable.  I'm also assuming
  147. that S: is in your PATH list.  For  more  information on this stuff, see the
  148. description of the  WorkBench  1.2  or  1.3  PATH  command,  the 1.3 PROTECT
  149. command, and the description of  scripts  in  the 1.3 book, pages 1-4 though
  150. 1-5.
  151.  
  152. Put the file  XAREAD.BAT  in  any  directory  on  your  MS-DOS  system  disk
  153. (probably the C: drive) that you have in your PATH.  You'll need to transfer
  154. it over with AREAD; this could be the last time you use AREAD directly.
  155.  
  156. AmigaDOS has a convention of storing  temporary  files  in the T: directory.
  157. XARead follows that convention.  If you  already have a T: directory, you're
  158. in good shape; otherwise,  you'll  have  to  create one.  To find out if you
  159. have one, try the AmigaDOS command  "DIR  T:".   If you get a file requestor
  160. asking you to mount volume T:, you don't have one, and must create one prior
  161. to using XAREAD (or  the  Amiga  supplied  SPAT  or  DPAT commands, for that
  162. matter).
  163.  
  164. To allocate a T:  directory,  first  issue  the  AmigaDOS  command  "MAKEDIR
  165. SYS:T".  You might get an  error  message  "SYS:T  already  exists".  That's
  166. okay.  Next, issue the command  "ASSIGN  T: SYS:T".  You'll be all set.  You
  167. probably want to put that  ASSIGN  command  in  your startup-sequence so you
  168. have it from now on.
  169.  
  170. Finally,  since  XAREAD  makes  use   of  the  WorkBench  1.3  environmental
  171. variables, you also need an ENV: directory.  The most straightforward way to
  172. do this is to just put the following commands in your startup sequence:
  173.  
  174.      MAKEDIR RAM:ENV
  175.      ASSIGN ENV: RAM:ENV
  176.  
  177.  
  178. VI.       Other Notes.
  179.  
  180. Unlike the more enlightened AmigaDOS, MS-DOS  limits its file names to a one
  181. to eight-character filename plus a  one  to  three character file extension.
  182. You really should only transfer  files  between  the two that conform to the
  183. MS-DOS restrictions.  If you have  a  file  on  the Amiga side that does not
  184. conform to these restrictions,  you  can't  transfer  it to the IBM side and
  185. retain the same name.  For example, if  you had a file named ROUGHDRAFT.TEXT
  186. on DF0:, and wanted to transfer  it  to  the  A:  drive using AREAD directly
  187. (without XAREAD), you'd probably do something like this:
  188.  
  189.      AREAD DF0:ROUGHDRAFT.TEXT A:RUFDRAFT.TXT
  190.  
  191. because you know the about the MS-DOS filename limitations.  However XAREAD,
  192. not having anywhere near  your  intelligence,  will  generate  the following
  193. AREAD command for execution:
  194.  
  195.      AREAD DF0:ROUGHDRAFT.TEXT A:ROUGHDRAFT.TEXT
  196.  
  197. The "A:ROUGHDRAFT.TEXT" is an illegal MS-DOS  filename.  No big deal; MS-DOS
  198. conventions truncate too-long filenames and extensions, and it will treat it
  199. as if you entered it this way:
  200.  
  201.      AREAD DF0:ROUGHDRAFT.TEXT A:ROUGHDRA.TEX
  202.  
  203. dropping the "FT" and "T"  off  the  ends  of  the  filename parts.  No real
  204. problem here.    However, what if you  have  two files on DF0: that you want
  205. to transfer to A:, with the names TERMPAPER1.TEXT and TERMPAPER2.TEXT?  With
  206. straight AREAD, you'd be smart enough to do this:
  207.  
  208.      AREAD DF0:TERMPAPER1.TEXT A:TERMPAP1.TXT
  209.      AREAD DF0:TERMPAPER2.TEXT A:TERMPAP2.TXT
  210.  
  211. No problem.  But using XAREAD, you'd probably do this:
  212.  
  213.      XAREAD DF0:TERMPAPER#? A:
  214.  
  215. Which would generate this:
  216.  
  217.      AREAD DF0:TERMPAPER1.TEXT A:TERMPAPER1.TEXT
  218.      AREAD DF0:TERMPAPER2.TEXT A:TERMPAPER2.TEXT
  219.  
  220. Which would be treated as if the AREAD commands were:
  221.  
  222.      AREAD DF0:TERMPAPER1.TEXT A:TERMPAPE.TEX
  223.      AREAD DF0:TERMPAPER2.TEXT A:TERMPAPE.TEX
  224.  
  225. In other words, the  first  AREAD  would  copy  over  TERMPAPER1.TEXT to the
  226. MS-DOS  file   TERMPAP.TEX.    Then   the   second  AREAD  would  copy  over
  227. TERMPAPER2.TEXT, also to MS-DOS file TERMPAP.TEX, overwriting and destroying
  228. what the first AREAD brought over  (without  warning,  by the way).  I don't
  229. know what to tell you about  this  except  to  be  careful.  On the positive
  230. side, the original  files  on  the  Amiga  side  are  still  intact; you can
  231. retransmit them manually, or rename them to MS-DOS compliant names and reuse
  232. XAREAD.
  233.  
  234.  
  235. VII.      Examples.
  236.  
  237. On each of these examples, unless otherwise  specified, I'm only showing the
  238. syntax on the Amiga side.   The  IBM  side,  you  just  type  XAREAD with no
  239. options (after you did the XAREAD on the Amiga side).
  240.  
  241. 1) Transfer all files from Amiga's DF0: to IBM's A: drive, translating Amiga
  242. character  set  to  IBM-compatible  (i.e.,  the  files  are  assumed  to  be
  243. non-binary text files).  Note that if DF0:  is full, you'll run out of space
  244. on the A: drive, since an Amiga 3.5 inch disk holds 880K, while the IBM 5.25
  245. inch disks (at least the ones that work with my setup) only hold 360K:
  246.  
  247.      XAREAD DF0:#? A:
  248.  
  249. 2) Transfer all GIF files on the RAM: disk to the directory named GIF on the
  250. IBM side, suppressing translation (GIFs are binary files):
  251.  
  252.      XAREAD RAM:#?.GIF \GIF /b
  253.  
  254. 3) Another way of doing the same thing:
  255.  
  256.      XAREAD RAM:#?.GIF . /b
  257.  
  258. then, on the MSDOS side:
  259.  
  260.      CD \GIF
  261.      XAREAD
  262.  
  263. In ex. 2, we specify that the  destination  directory is \GIF.  In ex. 3, we
  264. specify that the destination directory  is the current MS-DOS directory (.),
  265. and make the \GIF directory  the  current  directory  before  commencing the
  266. transfer.
  267.  
  268. 4) Copy all the .COM and .EXE files (binary) from the TEMP: assigned name to
  269. the MS-DOS directory named \TEMP\COMMANDS:
  270.  
  271.      XAREAD TEMP:#?.((COM)|(EXE)) \TEMP\COMMANDS /b
  272.  
  273. 5) Copy all the .TXT files that begin with a "J" from the TEMP: directory to
  274. the "TEXT" directory on the A: disk,  translating  them  from Amiga ASCII to
  275. IBM ASCII:
  276.  
  277.      XAREAD TEMP:B#?.TXT A:\TEXT
  278.  
  279. 6)  Copy all the files from an IBM 720K 3.25 disk in DF2: to the MS-DOS root
  280. directory, using the Consultron product  CrossDos (you have to have at least
  281. the CrossDos demo program for this to work), as binary files:
  282.  
  283.      XAREAD DI2:#? \ /b
  284.  
  285. Incidentally, if you ever have a need to  read IBM 720K 3.25 inch diskettes,
  286. get the CrossDos demo.  It's worth  the  download  time wherever you get it.
  287. The  demo  allows  read-only  access  to  IBM  disks  in  the  Amiga  drives
  288. (low-density only, because the drives  themselves  can't handle the 1.44 meg
  289. format).  If you need read-write access, go buy the real thing.
  290.  
  291.  
  292. VIII.     Acknowledgements.
  293.  
  294. I got the idea for this from the way IBM  does their multiple file transfers
  295. on their IBMLink  service.   They,  too,  create  a  batch  file that can be
  296. downloaded to the PC, and which  contains  all  the commands to download the
  297. other files.  It doesn't work, but  at  least  they were headed in the right
  298. direction.
  299.  
  300. If you look at the XAREAD AmigaDOS batch  file, you'll see some similarities
  301. to the SPAT batch file that came with WorkBench 1.3.  That also helped.
  302.  
  303.  
  304. IX.       Warranty.
  305.  
  306. Are you kidding?  Use at your own risk.
  307.  
  308.  
  309. X.        Status, contacts, etc.
  310.  
  311. These files are Public Domain.  You  can  distribute them anywhere you like,
  312. but I ask that you keep the files in  the  .LZH file together and unaltered.
  313. If you have any questions, comments,  or  suggestions  I'd love to hear from
  314. you.  I'd also like to hear from you  if  you make any improvements.  Like I
  315. noted above, there're a lot of areas that  XAREAD is a little dumb, allowing
  316. you  to  do  things  wrong,  and   there   are  probably  opportunities  for
  317. improvement.  If you make any, please let me know.
  318.  
  319. Again, this is Public Domain, not ShareWare, but if you like this and use it
  320. a lot, and want to express your appreciation in a financial way, please make
  321. a contribution to the American Cancer Society, and drop me a line and let me
  322. know you did.  That would make my day.
  323.  
  324.  
  325.      Terry Carroll
  326.      CAAUG BBS ((216)-642-3344) User ID Terry Carroll
  327.      PC-Ohio  ((216)-381-3320) User ID Terry Carroll
  328.      CompuServe User ID 71550,133
  329.  
  330.      23 November 1990
  331.  
  332.  
  333.